<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>广告上架</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <link href="${pageContext.request.contextPath}/static/css/common.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">
    <!-- jqgrid-->
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/custom.ui.jqgrid.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/style.css" rel="stylesheet">

    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer/layer.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/static/js/jquery.form.js" type="text/javascript"></script>
	<style>
		.jqGrid_wrapper{*+margin-left:270px;}
	
		.lt,.col-sm-3,.col-sm-8{float:left}
		.form-group{*+overflow:hidden;}
		.form-group label{width:31%\9;*+width:22%;text-align:right\9;*+text-align:right;}
		.col-sm-8 .m-t2 {width:30%\9; *+width:36%;}
		.form-group .col-sm-8{width:66%\9;*+width:66%;}
		.form-group .form-control{*+width:95%;}
		.form-control{*+height:22px;}
		#sub{*+margin-right:10px;}
		.input-group .form-control{*+z-index:-1;}
		.upload{*+position:relative;}
		.btn-primary{*+position:absolute;*+left:431px;*+top:-35px;*+z-index:3;}
	</style>
</head>
<body>
<div class="col-sm-12">
    <form class="form-horizontal m-t" method="post" id="form"
          action="${pageContext.request.contextPath}/admin/bannerResource_add.action" enctype="multipart/form-data">
        <input type="hidden" name="size" value="${size}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label"><i class="require">*</i>资源名称:</label>
            <div class="col-sm-8">
                <input class="form-control" name="cName" size="30"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label"><i class="require">*</i>资源类型:</label>
            <div class="col-sm-8">
                <div class="col-sm-2 m-t2">
                    <input type="radio" checked name="type" size="30" value="1"/><label>图片</label>
                </div>
                <div class="col-sm-2 m-t2">
                    <input type="radio" name="type" size="30" value="2"/><label>h5链接</label>
                </div>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 control-label"><i class="require">*</i>资源是否共享:</label>
            <div class="col-sm-8">
                <div class="col-sm-2 m-t2">
                    <input type="radio" checked name="ifShare" size="30" value="1"/><label>共享</label>
                </div>
                <div class="col-sm-2 m-t2">
                    <input type="radio" name="ifShare" size="30" value="0"/><label>不共享</label>
                </div>
            </div>
        </div>
        <div class="form-group" id="mTypeDiv">
            <label class="col-sm-3 col-sm-3 control-label"><i class="require">*</i>上传资源:</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <input class="form-control" name="content" readonly size="30"/>
                    <div class="input-group-addon upload">
                        <input class="form-control" id="upload" type="file" name="upload"
                               style="position: absolute;width: 60px;opacity: 0;"/>
                        <a class="btn btn-primary">上传</a>
                    </div>
                </div>
        <div style="margin-top: 6px;margin-bottom: 0px;font-family: 微软雅黑;font-size: 12px;color:#999999;">
            <c:if test="${sessionScope.user.rLevel != 3}">
        	*上传图片要求：尺寸为750*300，JPEG(*.JPG、*.JPEG、*.JPE)格式或是PNG格式
            </c:if> 
            <c:if test="${sessionScope.user.rLevel == 3}">
        	*上传图片要求：尺寸为750*350，JPEG(*.JPG、*.JPEG、*.JPE)格式或是PNG格式
            </c:if>        
		</div> 
                
            </div>
        </div>
     
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">URL:</label>
            <div class="col-sm-8">
                <input class="form-control" name="cUrl" id="cUrl" size="30"/>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">结算方式:</label>
            <div class="col-sm-8">
                <input class="form-control" name="settlementMethod" size="30"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">预计收益:</label>
            <div class="col-sm-8">
                <input class="form-control" name="expectedIncome" size="30"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">广告详情:</label>
            <div class="col-sm-8">
                <input class="form-control" name="adDetails" size="30"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">上架人:</label>
            <div class="col-sm-8">
            	<input class="form-control" name="operator" size="30" value="${sessionScope.user.uname}" disabled="disabled"/>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 col-sm-3 control-label">上架时间:</label>
            <div class="col-sm-8">
            	<input class="form-control" name="cTime" size="30" id="cTime" disabled="disabled"/>
            </div>
        </div>
    </form>
</div>
<script>
    $(function () {
    	var date = new Date();
        var seperator1 = "-";
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        var currentdate = year + seperator1 + month + seperator1 + strDate;
    	$("#cTime").val(currentdate);
    	

        $("#upload").change(function () {
            var filename = $(this).val();
            var index = filename.lastIndexOf("\\");
            $("input[name='content']").val(filename.substring(index + 1));
        });

        $('input:radio[name="type"]').change( function(){
        	var selectedvalue = $("input:radio[name='type']:checked").val();
			if (selectedvalue == 1) {
				$("#mTypeDiv").attr("style","");
			} else {
				$("#mTypeDiv").attr("style","display:none");
			}
        }); 

    });
    
</script>
</body>
</html>
